package com.nsfocus.mode;

/**
 * @File: MessageFactory.java
 * @User: Liangkangkang
 * @Date: 17-4-24
 * @Time: 下午8:35
 * @Mail: liangkangkang@yahoo.com
 * @Desc:
 * @Version:工厂只有一个，通常和单例进行结合使用,它都是静态的方法
 */


import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

/**
 * factory mode
 */
class FactoryDemo {
    /**
     * 解析报文,返回消息对象
     */
    public static FactoryDemo parsePacket(InputStream is) {
        FactoryDemo msg = null;
        try {
            int type = is.read();
            switch (type) {
                case 1:
                    ;
                    break;
                case 2:
                    ;
                    break;
                default:
                    ;
            }
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return msg;
    }
}

public class MessageFactory {
    public static void main(String[] args) {
//        Factory.parsePacket(new FileInputStream(null));
        new Thread(){
            @Override
            public void run() {
                super.run();
            }
        }.start();
    }
}
